package com.cf.utils;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;

public class ObjectNull {
	public static Object handle(Object param) {

		if (param instanceof Integer) {
			if (StringUtils.isEmpty(param.toString()))
				param = 0;

		} else if (param instanceof String) {
			if (StringUtils.isEmpty(param.toString()))
				param = "";

		} else if (param instanceof Double) {
			if (StringUtils.isEmpty(param.toString()))
				param = 0;

		} else if (param instanceof Float) {
			if (StringUtils.isEmpty(param.toString()))
				param = 0;

		} else if (param instanceof Long) {
			if (StringUtils.isEmpty(param.toString()))
				param = 0;

		} else if (param instanceof Boolean) {
			if (StringUtils.isEmpty(param.toString()))
				param = false;

		} else if (param instanceof Date) {
			if (StringUtils.isEmpty(param.toString()))
				param = new Date();
		}

		return param;
	}
}
